import {Route} from "vue-router";
import router from "@/core/router/router";
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

NProgress.configure({showSpinner: false});

router.beforeEach(async (to: Route, _: Route, next: any) => {
        NProgress.start(); // start progress bar
        next();
    }
);


/**
 * 路由跳转后--监听
 */
router.afterEach((to: Route) => {
    document.title = to.meta.title;
    setTimeout(() => {
        NProgress.done();
    }, 2000)
});

export default router
